#ifndef APP_MYSQL_H
#define APP_MYSQL_H

#include <mysql/mysql.h>
#include <list>
#include "DataStruct.h"

using namespace std;

int database_start(char *name, char *pwd);
void database_end();

int addStation_mysql(char *name);
int deleteStation_mysql(char *name);
int deleteStation_mysql(int id);
int modifyStation_mysql(int id,char *newName);
int queryStation_mysql(char *name);
char* queryStation_mysql(int id);

//int database_start_train(char *name, char *pwd);
//void database_end_train();
int addTrain_mysql(char *num, int station, char *time);
//int deleteTrain_mysql(char *name);
int deleteTrain_mysql(char *num);
int modifyTrain_mysql(int id,char *newNum,int newStation, char *newTime);
Train queryTrain_mysql(char *num);

int addTicket_mysql(int ticketType, char *date, char *trainNum, int startStation, int arrivalStation, double price, char *seatNum, char *userID);
int deleteTicket_mysql(int id);
//int modifyTicket_mysql(int id,char *newNum,int newStation, char *newTime);
list<TrainTicket> queryTicket_mysql(char *userID);
TrainTicket queryTicketTypeDate_mysql(int id);

int addTicketType_mysql(char *trainNum, int startStation, int arrivalStation, int seatNum, double price);
int deleteTicketType_mysql(int id);
//int modifyTicket_mysql(int id,char *newNum,int newStation, char *newTime);
Ticket queryTicketType_mysql(int id);

int addTicketRecord_mysql(int ticketType, char *data, int ticketNum, int restNum);
int deleteTicketRecord_mysql(int id);
int modifyTicketRecord_mysql(int id, int restNum);
list<TicketRecord> queryTicketRecord_mysql(int start, int arrival, char *date);
TicketRecord queryRestNum_mysql(int ticketType, char *date);

int addUser_mysql(char *id, char *name, char *password, char *idNum);
int deleteUser_mysql(char *id);
int modifyUser_mysql(char *id, char *newName, char *newPassword);
User queryUser_mysql(char *id);


#endif // APP_MYSQL_H
